package kibahed.interfaces.cards;

import java.util.LinkedList;
import java.util.List;

public class CardFactory {

	public static List<Card> getCardDeck(EGame game) {
		List<Card> cards = new LinkedList<Card>();

		switch (game) {

		case SCHNAPSEN:
			cards = getSchnapsCards();
		case BAUERNSCHNAPSEN:

		case POKER:

		case BLACKJACK:

		}

		return cards;
	}

	public static Card getCard(EGame game, ESuite suite, ECardValue cardValue) {
		Card card = new Card();
		switch (game) {

		case SCHNAPSEN:
			card = getSchanpsCard(suite, cardValue);
			break;
		case BAUERNSCHNAPSEN:

		case POKER:

		case BLACKJACK:

		}
		return card;
	}

	private static Card getSchanpsCard(ESuite suite, ECardValue cardValue) {
		Card card = new Card();

		card.setSuite(suite);
		card.setCardValue(cardValue);

		switch (cardValue) {
		case BUB:
			card.setValue(2);
			break;
		case DAME:
			card.setValue(3);
			break;
		case KOENIG:
			card.setValue(4);
			break;
		case ZEHN:
			card.setValue(10);
			break;
		case ASS:
			card.setValue(11);
			break;
		default:
			break;
		}

		return card;
	}

	private static List<Card> getSchnapsCards() {
		List<Card> cards = new LinkedList<Card>();
		for (ESuite suite : ESuite.values()) {
			Card c1 = new Card(suite, ECardValue.BUB, 2);
			Card c2 = new Card(suite, ECardValue.DAME, 3);
			Card c3 = new Card(suite, ECardValue.KOENIG, 4);
			Card c4 = new Card(suite, ECardValue.ZEHN, 10);
			Card c5 = new Card(suite, ECardValue.ASS, 11);
			cards.add(c1);
			cards.add(c2);
			cards.add(c3);
			cards.add(c4);
			cards.add(c5);
		}

		return cards;
	}
}
